import { ajax } from "../../utils/ajax"
import { changeCityTypes, changeCountTypes } from "../reducers/types"


export const countDesc ={
    type:"countDesc"
}
export function changeCount(payload){
    return{
        type:changeCountTypes,
        payload

    }
}
export function changeCity(payload){
    return{
        type:changeCityTypes,
        payload

    }
}

export function changeMsg(payload){
    return{
        type:"changeMsg",
        payload

    }
}

export function changeWord(payload){
    return{
        type:"changeWord",
        payload

    }
}

export function changeFlag(payload){
    return{
        type:"changeFlag",
        payload

    }
}

export function changeDataTest(payload){
    return{
        type:"changeDataTest",
        payload

    }
}

export function changeDataNum(payload){
    return{
        type:"changeDataNum",
        payload

    }
}


export function changeDataTestAsync(){
    return ajax.get("http://localhost:3000/api/test")
    .then(res=>{
        return {
            type:"changeDataTest",
            payload:res.data.msg
        }
    })
}

export async function getMovieList(){
    let res = await ajax.get("http://localhost:3000/movie")
    return {
        type:"getMovieList",
        payload:res.data.result 
    }
}